package unit3;

import java.util.Scanner;

public class Ex3_6_Max3 {
    //定义从三个数中取得最大值的方法maxFrom3()
    int maxFrom3(int x, int y, int z) { //x、y、z为形参
        int max;
        if (x > y)
            max = x;
        else
            max = y;
        if (max < z)
            max = z;
        return max ;
    }
    public static void main(String[] args) {
        Ex3_6_Max3 max = new Ex3_6_Max3(); // 创建Max3对象
        Scanner in = new Scanner(System.in);
        int m;
        System.out.print("请输入3个数：");
        int a = in.nextInt();
        int b = in.nextInt();
        int c = in.nextInt();
        m = max.maxFrom3(a, b, c); //调用类方法maxFrom3()，a、b、c为实参
        System.out.println("Max = " + m);
    }
}
